function f = fun_Linear_parameter_optimization(params, m, M)
    numImages = size(m,3);
    f = [];
    A = [params(1) 0 params(2);
        0 params(3) params(4); 
        0 0 1];

    for i = 1:numImages
        RT = params(1,5+(i-1)*6:10+(i-1)*6);
        vRot = RT(1,1:3);
        vT = RT(1,4:6);
        % Convert rotation matrix
        R = rotationVectorToMatrix(vRot); % MATLAB defines rotation matrix with row vectors
        RT_ = [R(:,1) R(:,2) vT'];
        m_ = A*RT_*M;
        m_=[m_(1,:)./m_(3,:);m_(2,:)./m_(3,:);m_(3,:)./m_(3,:)]';

        dm=m(:,:,i)-m_(:,1:2);
        dm=dm';
        f=[f,dm(1,:),dm(2,:)];   

    end

end